package file;

import java.io.File;

/**
 * 实例用于表示一个文件或目录，实际表示一个抽象路径
 * */
public class FileDemo {
    public static void main(String[] args) {
        //绝对路径
//        File file = new File("D:/JavaideaDemo_1/JSD2210/demo.txt");
        //相对路径
        File file = new File("./demo.txt");//./表示当前项目目录

        String name = file.getName();
        System.out.println("name:"+name);

        Long len = file.length();
        System.out.println("length:"+len);

        //判断是否隐藏文件
        boolean ih = file.isHidden();
        System.out.println("是否隐藏："+ih);
        //是否可读
        boolean cr = file.canRead();
        System.out.println("是否可读："+cr);
        //是否可写
        boolean cw = file.canWrite();
        System.out.println("是否可写："+cw);



    }
}
